package com.smartEdu.controller.app;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.smartEdu.commons.Session;
import com.smartEdu.commons.Tag_Tips;
import com.smartEdu.exception.ServiceException;
import com.smartEdu.response.Response;
import com.smartEdu.service.RongCloudService2;
import com.smartEdu.service.RongCloudeService;

@Controller
@RequestMapping(value="app")
public class RongCloudController2 extends AppBaseController{
	@Autowired
	@Qualifier(value="appresponse")
	public Response respContext;
	
	@Autowired
	@Qualifier(value="rongCloudeServiceImpl2")
	public RongCloudService2 rongCloudService2;
	
	
	@Override
	public String GetRespContent(Session sess) {
		// TODO Auto-generated method stub
		return respContext.GetRespContent(sess);
	}
	
	@RequestMapping(value="/rongcloud/returngroupnumber")
	public void addGroupId(HttpServletRequest request,HttpServletResponse response){
		Session sess=null;
		try {
			sess=GetSession();
			sess.put(Tag_Tips.REQUEST, GetParameter(request));
			rongCloudService2.returnGroupNumber(sess);
		} 
		catch (ServiceException e) {
			sess.put(Tag_Tips.RESPCODE, Tag_Tips.ERROR);
		}
		finally {
			SetResponse(response, sess);
		}
	}
	
	@RequestMapping(value="/rongcloud/retiregroup")
	public void retireGroup(HttpServletRequest request,HttpServletResponse response){
		Session sess=null;
		try {
			sess=GetSession();
			sess.put(Tag_Tips.REQUEST, GetParameter(request));
			rongCloudService2.deleteGroupOne(sess);
		} 
		catch (ServiceException e) {
			sess.put(Tag_Tips.RESPCODE, Tag_Tips.ERROR);
		}
		finally {
			SetResponse(response, sess);
		}
	}
	
	@RequestMapping(value="/rongcloud/cleargroup")
	public void clearGroup(HttpServletRequest request,HttpServletResponse response){
		Session sess=null;
		try {
			sess=GetSession();
			sess.put(Tag_Tips.REQUEST, GetParameter(request));
			rongCloudService2.deleteGroupAll(sess);
			
		} 
		catch (ServiceException e) {
			sess.put(Tag_Tips.RESPCODE, Tag_Tips.ERROR);
		}
		finally {
			SetResponse(response, sess);
		}
	}
	
}
